package lab02.test06;

/**
 * Created by asus on 2017/10/15.
 */
public class Triangle {
    double side1;
    double side2;
    double side3;
    double area;
    double perimeter;
    public void setSide1(double side1){
        this.side1=side1;
    }
    public void setSide2(double side2){
        this.side2=side2;
    }
    public void setSide3(double side3){
        this.side3=side3;
    }
    public double getSide1(){
        return side1;
    }
    public double getSide2(){
        return side2;
    }
    public double getSide3(){
        return side3;
    }
    public double getArea(){
        double p=(side1+side2+side3)/2;
        area=Math.sqrt(p*(p-side1)*(p-side2)*(p-side3));//海伦公式
    }
    public double getPerimeter(){
        perimeter=side1+side2+side3;
        return perimeter;
    }
    public void changeSide(int side1,int side2,int side3){
        this.side1=side1;
        this.side2=side2;
        this.side3=side3;
    }
    public void setNewSidel1(int side1){
        this.side1=side1;
    }
    public void setNewSidel2(int side2){
        this.side2=side2;
    }
    public void setNewSidel3(int side3){
        this.side3=side3;
    }
    public double getNewSide1(){
        return side1;
    }
    public double getNewSide2(){
        return side2;
    }
    public double getNewSide3(){
        return side3;
    }
    public boolean judgeSide(){
        if (side1+side2>side3&&side3+side2>side1&&side1+side3>side2&side1-side2<side3&&side3-side2<side1&&side1-side3<side2){
            return true;
        }
        else{
            return false;
        }
    }

}
